<?php
require_once("admin-header.php");
require_once ("../config/path_config.php");
require_once (ROOTDIR."common/db_utils.php");

$allowAccess = isset($_SESSION['administrator']);
$allowAccess |= isset($_SESSION['jgadmin']);
if ( !$allowAccess ) {
    exit(1);
}

$cid=$_GET['cid'];
$sql="select `defunct` FROM `users` WHERE `user_id`=?";
$result = DbUtil::getInstance()->query($sql, $cid);
$num=count($result);
if ($num<1){
	echo "未找到该用户";
	require_once("../oj-footer.php");
	exit(0);
}

$row=$result[0];
if ($row[0]=='N') 
	$sql="UPDATE `users` SET `defunct`='Y' WHERE `user_id`=?";
else 
	$sql="UPDATE `users` SET `defunct`='N' WHERE `user_id`=?";
DbUtil::getInstance()->query($sql, $cid);
?>
<script language=javascript>
	history.go(-1);
</script>

